import httpInstance from '@/utils/http';

//  apis/category.js
//获取二级分类列表
export function getCategoryAPI(id: number) {
  return httpInstance({
    url: '/category',
    params: {
      id,
    },
  });
}

/**
	apis/category.js
 * @description: 获取二级分类列表数据
 * @param {*} id 分类id 
 * @return {*}
 */

export const getCategoryFilterAPI = (id: number) => {
  return httpInstance({
    url: '/category/sub/filter',
    params: {
      id,
    },
  });
};

/**             apis/category.js
 * @description: 获取导航数据
 * @data { 
        categoryId: 1005000 ,
        page: 1,
        pageSize: 20,
        sortField: 'publishTime' | 'orderNum' | 'evaluateNum'
    } 
 * @return {*}
 */
export const getSubCategoryAPI = (data: object) => {
  return httpInstance({
    url: '/category/goods/temporary',
    method: 'POST',
    data,
  });
};
